/**
 * 
 */
package data.model.effort;

import java.util.Collection;

import data.model.Process;

/**

 * 
 */
public class DeltaEffort extends Effort {
	private final Collection<? extends Process> processes;

	/**
	 * @param processes
	 */
	public DeltaEffort(Collection<? extends Process> processes) {
		super("Delta");
		if (processes == null) {
			throw new IllegalArgumentException("processes must not be null");
		}
		this.processes = processes;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see data.EffortProvider#getEffortRequirementsEngineering()
	 */
	@Override
	public int getEffortRequirementsEngineering() {
		int effort = 0;
		for (Process process : processes) {
			Integer processEffort = process.getEffortRequirementsEngineering();
			effort += (processEffort != null ? processEffort : 0);
		}
		return effort;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see data.EffortProvider#getEffortArchitectureAndDesign()
	 */
	@Override
	public int getEffortArchitectureAndDesign() {
		int effort = 0;
		for (Process process : processes) {
			Integer processEffort = process.getEffortArchitectureAndDesign();
			effort += (processEffort != null ? processEffort : 0);
		}
		return effort;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see data.EffortProvider#getEffortImplementationAndIntegration()
	 */
	@Override
	public int getEffortImplementationAndIntegration() {
		int effort = 0;
		for (Process process : processes) {
			Integer processEffort = process
					.getEffortImplementationAndIntegration();
			effort += (processEffort != null ? processEffort : 0);
		}
		return effort;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see data.EffortProvider#getEffortBuildAndTest()
	 */
	@Override
	public int getEffortBuildAndTest() {
		int effort = 0;
		for (Process process : processes) {
			Integer processEffort = process.getEffortBuildAndTest();
			effort += (processEffort != null ? processEffort : 0);
		}
		return effort;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see data.EffortProvider#getEffortProjectManagement()
	 */
	@Override
	public int getEffortProjectManagement() {
		int effort = 0;
		for (Process process : processes) {
			Integer processEffort = process.getEffortProjectManagement();
			effort += (processEffort != null ? processEffort : 0);
		}
		return effort;
	}

}
